//
//  MHHTTPService+Music.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/10/15.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHHTTPService+Music.h"
#import "MHMusicCatergory.h"
#import "MHMusicModel.h"
#import "MHRedEnvelopeConfig.h"
#import "MHRedHistoryRecord.h"
#import "MHRedHistorySummary.h"
#import "MHSingleRecordlist.h"
#import "TCBGMHelper.h"
#import "MHOpenModel.h"
#import "MHPublishRedPacketCallBack.h"
@implementation MHHTTPService (Music)

-(RACSignal *) getSongCategoryList
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_SONG_GETSONGCATEGORYLIST parameters:subscript.dictionary];
    /// 3.发起请求
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHMusicCatergory class]];
}


-(RACSignal *) getSongPagedListWithSongName:(NSString *)songName categoryName:(NSString *)categoryName categoryId:(int )categoryId pageNum:(int) pageNum pageSize:(int) pageSize
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"songName"] = songName;
    subscript[@"categoryName"] = categoryName;
    subscript[@"categoryId"] = @(categoryId);
    subscript[@"pageNum"] = @(pageNum);
    subscript[@"pageSize"] = @(pageSize);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_SONG_GETSONGPAGEDLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[TCBGMElement class]];
}


-(RACSignal *) getHotSongList
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_SONG_GETHOTSONGLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[TCBGMElement class]];
}


-(RACSignal *) publishRedPacketWithCircleId:(int )circleId content:(NSString *)content locationData:(NSString *) locationData redData:(NSString *) redData  pay:(int )pay
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"circleId"] = @(circleId);
    subscript[@"content"] = content;
    subscript[@"locationData"] = locationData;
    subscript[@"redData"] = redData;
    subscript[@"pay"] = @(pay);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_PUBLISH parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHPublishRedPacketCallBack class]];
}

-(RACSignal *) bindShortVideoWithRecentId:(int )recentId  vedioData:(NSString *) vedioData
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"recentId"] = @(recentId);
    subscript[@"vedioData"] = vedioData;
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_BINDSHORTVIDEO parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHMoment class]];
}



-(RACSignal *) openRedPacketWithRedId:(int )redId  lat:(CGFloat ) lat lon:(CGFloat ) lon
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"redId"] = @(redId);
    subscript[@"lat"] = @(lat);
     subscript[@"lon"] = @(lon);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_OPEN parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHOpenModel
                                class]];
}

-(RACSignal *) openRedPacketWithRedId:(int )redId
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"redId"] = @(redId);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_RECORDLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHSingleRecordlist class]];
}


-(RACSignal *) getUserRedHistorySummary
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_GETUSERREDHISTORYSUMMARY parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHRedHistorySummary class]];
}


-(RACSignal *) getRedHistoryRecordPagedListWithType:(RedPacketHistoryType ) type pageNum:(int) pageNum pageSize:(int) pageSize
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"type"] = @(type);
    subscript[@"pageNum"] = @(pageNum);
    subscript[@"pageSize"] = @(pageSize);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_GETREDHISTORYRECORDPAGEDLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHRedHistoryRecord class]];
}


-(RACSignal *) getMyRecentPagedListWithPageNum:(int) pageNum pageSize:(int) pageSize
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"pageNum"] = @(pageNum);
    subscript[@"pageSize"] = @(pageSize);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_USER_GETMYRECENTPAGEDLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHAwemeModel class]];
}

-(RACSignal *) getVideoPagedListByMyRecentWithRecentId:(int) recentId  PageNum:(int) pageNum pageSize:(int) pageSize
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"recentId"] = @(recentId);
    subscript[@"pageNum"] = @(pageNum);
    subscript[@"pageSize"] = @(pageSize);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_USER_GETVIDEOPAGEDLISTBYMYRECENT parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHAwemeModel class]];
}


-(RACSignal *) getMyCollectRecentPagedListWithPageNum:(int) pageNum pageSize:(int) pageSize
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    subscript[@"pageNum"] = @(pageNum);
    subscript[@"pageSize"] = @(pageSize);
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_USER_GETMYCOLLECTRECENTPAGEDLIST parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHAwemeModel class]];
}



-(RACSignal *) getRedEnvelopeConfig
{
    MHKeyedSubscript *subscript = [MHKeyedSubscript subscript];
    MHURLParameters *paramters = [MHURLParameters urlParametersWithMethod:MH_HTTTP_METHOD_POST path:MH_POST_REDENVELOPE_getRedEnvelopeConfig parameters:subscript.dictionary];
    return [[MHHTTPRequest requestWithParameters:paramters]
            enqueueResultClass:[MHRedEnvelopeConfig class]];
}



@end
